package com.leo.boot.web.exception;

import com.leo.boot.web.vo.ResultStatus;
import com.leo.boot.web.vo.Status;
import lombok.Getter;

@Getter
public class BusinessException extends RuntimeException implements Status {

    private Integer code;

    private Object error;

    public BusinessException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(Integer code, String message, Object error) {
        super(message);
        this.code = code;
        this.error = error;
    }

    public BusinessException(ResultStatus status) {
        super(status.getMessage());
        this.code = status.getCode();
    }

    public BusinessException(ResultStatus status, Object error) {
        super(status.getMessage());
        this.code = status.getCode();
        this.error = error;
    }
}
